home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
VideoToolbox 96.06.15
/
VideoToolboxSources
/
TrapAvailable.c
< prev
next >
Wrap
Text File
|
1995-07-27
|
860b
|
42 lines
/*
TrapAvailable.c
From Apple. Simply include <Traps.h> in your program and call this routine to find
out whether any particular trap is available.
*/
#include "VideoToolbox.h"
#ifndef __TRAPS__
#include <Traps.h>
#endif
// these are for internal use only
short NumToolboxTraps(void);
TrapType GetTrapType(short theTrap);
Boolean TrapAvailable(short theTrap)
{
TrapType tType;
tType=GetTrapType(theTrap);
if(tType==ToolTrap){
theTrap &= 0x07FF;
if(theTrap>=NumToolboxTraps())theTrap=_Unimplemented;
}
return NGetTrapAddress(theTrap,tType) != NGetTrapAddress(_Unimplemented,ToolTrap);
}
short NumToolboxTraps(void)
{
if (NGetTrapAddress(_InitGraf,ToolTrap) == NGetTrapAddress(0xAA6E,ToolTrap))
return 0x0200;
else return 0x0400;
}
TrapType GetTrapType(short theTrap)
{
if((theTrap & 0x0800)>0) return ToolTrap;
else return OSTrap;
}